﻿using CarAppDto.Base;
using CarAppDto.CarType.CountryDtos;
using FluentValidation;

namespace CarAppDto.CarType.CarDtos
{
    public class ReqAddCarValidator : AbstractValidator<ReqAddCar>
    {
        /// <summary>
        /// 校验规则写到校验类的构造方法中
        /// </summary>
        public ReqAddCarValidator()
        {
            RuleFor(x => x.VIN).NotEmpty().Length(1, 36);
            RuleFor(x => x.VehicleSeriesId).NotEmpty().Length(1, 36);
            RuleFor(x => x.CarTypeId).NotEmpty().Length(1, 36);
            RuleFor(x => x.CarTypeVersionId).NotEmpty().Length(1, 36);
        }
    }

    public class ReqAddCar : BaseAddModel
    {
        /// <summary>
        /// VIN
        /// </summary>
        public string? VIN { get; set; }

        /// <summary>
        /// 所属车系信息
        /// </summary>
        public string? VehicleSeriesId { get; set; }

        /// <summary>
        /// 所属车型信息
        /// </summary>
        public string? CarTypeId { get; set; }

        /// <summary>
        /// 所属车型版本信息
        /// </summary>
        public string? CarTypeVersionId { get; set; }
    }
}
